<!doctype html>
<html>
<head><base href="/">
<meta charset="utf-8">
<title>layui.form小例子</title>
<link rel="stylesheet" href="js/layui/css/layui.css"  media="all">
</head>
<body>
#include("/WEB-INF/_system/common/control2.html")
<form  id="form"  class="layui-form layui-form-pane"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
<input hidden="" type="text" value="#(e.id)" name="id" placeholder="请输入名称"  >
 <#list tableCommentFormInline as po>
			<#if po_index%2==0>
<div  class="layui-form-item">
			</#if>
  <#--  <label class="layui-form-label">${po.columnComment}</label>
    <div class="layui-input-inline">
      <input  type="text" value="#(e.${po.columnName})" name="${po.columnName}" placeholder="请输入${po.columnComment}" autocomplete="off" class="layui-input">
    </div>-->
    <#if po.controlType=="input_text">
    #@input_text('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_password">
    #@input_password('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_date_festival">
    #@input_date_festival('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_date_time">
    #@input_date_time('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_date_rangex">
    #@input_date_rangex('${po.columnName}','${po.columnComment}',1,1,e.${po.columnName})
    </#if>
			<#if (po_index+1)%2==0>
  </div>
			</#if>
 </#list>
 <#list tableCommentFormBlock as po>
 <div  class="layui-form-item" pane>
    <#if po.controlType=="input_radio">
    #@input_radio('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_checkbox_default">
    #@input_checkbox_default('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_checkbox_primary">
    #@input_checkbox_primary('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_checkbox_switch_CN">
    #@input_checkbox_switch_CN('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_checkbox_switch_EN">
    #@input_checkbox_switch_EN('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_date_rangeTwo">
    #@input_date_rangeTwo('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_date_time_rangeTwo">
    #@input_date_time_rangeTwo('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_areatext">
    #@input_areatext('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="input_select">
    #@input_select('${po.columnName}','${po.columnComment}','${po.dTable}','${po.dCode}','${po.dText}',e.${po.columnName})
    </#if>
    <#if po.controlType=="ueditor">
    #@ueditor('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
    <#if po.controlType=="ueditor_xiumi">
    #@ueditor_xiumi('${po.columnName}','${po.columnComment}',e.${po.columnName})
    </#if>
  </div>
  </#list>
  <div class="layui-form-item">
  #if(t=="edit")
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  #end
  </div>
  <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</form>
<script>
layui.use(['form','layer'], function(){
  var form = layui.form();
  form.render(); //更新全部
  //各种基于事件的操作，下面会有进一步介绍
  form.on('submit(*)', function(data){
	  console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
	  console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
	  console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
	  $.ajax({
          url:'/${tableName}/doedit/#(e.id)',
          type:'POST', //GET
          data:$("#form").serializeArray(),
          timeout:5000,    //超时时间
          dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
          success:function(data,textStatus,jqXHR){
          parent.list(parent.$("#search").data("pageNumber"));
          var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
          parent.layer.close(index);//关闭弹出的子页面窗口
          parent.layer.msg(data.msg, {icon: 1});
          },
          eorror:function(){
          layer.msg('网络发生错误，请联系管理员！', {icon: 2});
          }
      });
	  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	});
});
#if(t=="see")
$(function(){
	$("body").attr("readonly","readonly");
});
#end
</script></body></html>